<template>
  <component
    :is="name"
    v-bind="$attrs"
    v-on="mixedEvent"
  />
</template>

<script>
import Black from '../layouts/Black'
/**
 * 这是个通用视图组件
 */
export default {
  props: {
    /**
     * 组件名称
     */
    name: {
      type: String,
      default: Black.name
    },
    /**
     * 关联事件
     */
    event: {
      type: Object,
      default: () => null
    }
  },
  computed: {
    mixedEvent () {
      const that = this
      return {
        ...that.event,
        ...that.$listeners
      }
    }
  },
  components: {
    Black,
    Main: () => import('../layouts/Main.vue'),
    Discipline: () => import('../layouts/Discipline'),
    TableView: () => import('./TableView.vue'),
    FormView: () => import('./FormView.vue'),
    EdToolbar: () => import('../components/EdToolbar.vue'),
    EdMenu: () => import('../components/EdMenu.js'),
    UploadView: () => import('./UploadView'),
    ChartView: () => import('./ChartView')
  }
}
</script>

<style scoped>

</style>
